package com.my.cd.strategy;

/**
 * 鸭子主体抽象类
 */
public abstract class Duck {

    FlyBehavior mFlyBehavior;//飞行行为抽象

    QuackBehavior mQuackBehavior;//叫声抽象

    public Duck() {
    }

    public void fly() {
        mFlyBehavior.fly();
    }

    public void quack() {
        mQuackBehavior.quack();
    }

    public abstract void display();

    public void setQuackBehavoir(QuackBehavior qb) {
        mQuackBehavior = qb;
    }

    public void setFlyBehavoir(FlyBehavior fb) {
        mFlyBehavior = fb;
    }

    public void swim() {
        System.out.println("~~im swim~~");
    }
}
